export default {
		data() {
			return {
				url: "",
				path: "",
				cblist:[],
				data:{},
				password:'',
				show: false,
				showModal:false,
				showContent:'',
			}
		},
		onLoad(){
			this.$api.findByHealthId().then((res)=>{
				this.data = res.data.result;
			})
		},
		methods: {
			toRecord(){
				uni.navigateTo({
					url:'/pages/quickly/user/record'
				})
			},
			confirm(){
				let passCode = /(?!.*\s)(?!^[\u4E00-\u9FA5]+$)(?!^[a-zA-Z]+$)(?!^[\d]+$)(?!^[^\u4E00-\u9FA5a-zA-Z\d]+$)^.{6,20}$/
				if (!(passCode.test(this.password))) {
					this.showModal = true
					this.showContent = '密码不少于6位数，且字母、数字和符号至少包含两种。'
					return;
				}
				this.$api.updatePassword(this.password).then((res)=>{
					if(res.data.returnCode == '200'){
						uni.showToast({title:'修改成功',icon:'none'});
						localStorage.removeItem('userInfo');
						setTimeout(() => {
							uni.navigateTo({
								url:'/pages/login/index'
							})
						},1000)
					}
				})
			},
			// 修改密码
			modify() {
				this.show = true;
			},
			passwordBlur(){
				let passCode = /(?!.*\s)(?!^[\u4E00-\u9FA5]+$)(?!^[a-zA-Z]+$)(?!^[\d]+$)(?!^[^\u4E00-\u9FA5a-zA-Z\d]+$)^.{6,20}$/
				if (!(passCode.test(this.password))) {
					this.showModal = true
					this.showContent = '密码不少于6位数，且字母、数字和符号至少包含两种。'
					return;
				}
			},
			loginOut(){
				this.$api.logout().then((res)=>{
					if(res.data.returnCode == '200'){
						uni.showToast({
							title:'退出成功',
							icon:'none'
						})
						this.$im.disconnect().then(function() {
							console.log('断开链接成功');
						});
						localStorage.removeItem('userInfo');
						uni.removeStorageSync('account');
						uni.removeStorageSync('password');
						setTimeout(()=>{
							uni.reLaunch({
								url:'/pages/login/index'
							})
						},1000)
						
					}
				})
			}
		}
	}